package com.itheima.test2;

public class Demo2 {
    public static void main(String[] args) {
        InterImpl i  = new InterImpl();
        i.show();
        System.out.println("------------------");
        new Inter() {
            @Override
            public void show() {
                System.out.println("匿名重写的方法");
            }
        }.show();
        System.out.println("----------------------");
        Inter1 i1 = new Inter1() {
            @Override
            public void fun1() {
                System.out.println("fun1");
            }

            @Override
            public void fun2() {
                System.out.println("fun2");
            }
        };
        i1.fun1();
        i1.fun2();
    }
}
interface Inter{
    void show();
}
interface Inter1{
    void fun1();
    void fun2();
}
class InterImpl implements Inter{
    @Override
    public void show() {
        System.out.println("重写的方法");
    }
}
